<template>
  <form id="loginForm">
    <label for="username">Username:</label>
    <input type="text" id="username" name="username" v-model="username"><br>
    <label for="password">Password:</label>
    <input type="password" id="password" name="password" v-model="password"><br>
    <input type="button" @click="fasong" value="登录"><br>
    <label>11111111111111111111111111111111111111111</label>
  </form>
</template>

<script>
import axios from "axios";

export default {
  name: "Login",
  data() {
    return {
      userData:{
      username: '',
      password: ''
    }
    }
  },
  methods: {
    fasong() {
      const userData = this.userData;
      const url = 'http://localhost:8080/webdemo_war/Login';
      fetch(url,{
        method: 'GET',
        headers: {
          'Content-Type': 'application/json',
        },
        body: userData
      }).then(response => {
            if(!response.ok) {
              throw new Error('Network response was not ok')
            }
            return response.json();
      })

    }
  }
}
</script>

<style scoped>

</style>